export default {
    namespaced: true,
    state:{
        isShowAppGuide: true,
        direction: 'forward',
        isTabShow                : true,
        appTabContentBottomValue : 50,
        nowSelectedTabIndex      : 0,
        tabMenuData : [
            {
              tabIndex : 0,
              tabName  : '首页',
              tabIsSelected : true,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/shouye.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/shouye1.png',
              tabPath     : '/home',
              tabIconSrc  : 'home'
            },
            {
              tabIndex : 1,
              tabName  : '传播管理',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/chuanbo.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/chuanbo1.png',
              tabPath     : '/communicationList',
              tabIconSrc  : 'ravelry'
            },
            {
              tabIndex : 2,
              tabName  : '代理商',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/daili.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/daili1.png',
              tabPath     : '/agent',
              tabIconSrc  : 'cogs'
            },
            {
              tabIndex : 3,
              tabName  : '我的',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/wode.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/wode1.png',
              tabPath     : '/user',
              tabIconSrc  : 'user'
            }
        ],
        tabMenuData1 : [
            {
              tabIndex : 0,
              tabName  : '首页',
              tabIsSelected : true,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/shouye.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/shouye1.png',
              tabPath     : '/home',
              tabIconSrc  : 'home'
            },
            {
              tabIndex : 1,
              tabName  : '传播管理',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/chuanbo.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/chuanbo1.png',
              tabPath     : '/communicationList',
              tabIconSrc  : 'ravelry'
            },
            {
              tabIndex : 2,
              tabName  : '代理商',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/daili.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/daili1.png',
              tabPath     : '/agent',
              tabIconSrc  : 'cogs'
            },
            {
              tabIndex : 3,
              tabName  : '我的',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/wode.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/wode1.png',
              tabPath     : '/user',
              tabIconSrc  : 'user'
            }
        ],
        tabMenuData2 : [
            {
              tabIndex : 0,
              tabName  : '首页',
              tabIsSelected : true,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/shouye.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/shouye1.png',
              tabPath     : '/home',
              tabIconSrc  : 'home'
            },
            {
              tabIndex : 1,
              tabName  : '传播管理',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/chuanbo.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/chuanbo1.png',
              tabPath     : '/communicationList',
              tabIconSrc  : 'ravelry'
            },
            {
              tabIndex : 2,
              tabName  : '我的',
              tabIsSelected : false,
              tabBadge    : 0,
              tabIconType : 'font',
              tabIconImg  : '../../../../CRM/static/homeImages/wode.png',
              tabIconImg1 : '../../../../CRM/static/homeImages/wode1.png',
              tabPath     : '/user',
              tabIconSrc  : 'user'
            }
        ]
    },
    mutations:{

        abc(state,payload){
            state.direction = payload.direction
        },

        updateIsShowAppGuide(state,status){
            state.isShowAppGuide = status
        },

        //初始化菜单
        initTabMenu(state,data){

            state.nowSelectedTabIndex = data;

            //修改当前选中tab
            for(var i=0;i<state.tabMenuData.length;i++){
                if(state.tabMenuData[i].tabIndex == data){
                   state.tabMenuData[i].tabIsSelected = true;
                }else{
                   state.tabMenuData[i].tabIsSelected = false; 
                }
            }

        },

        //隐藏底部Tab
        hiddenAppTab(state){
            state.isTabShow = false
            state.appTabContentBottomValue = 0
        },

        //显示底部Tab
        showAppTab(state){
            state.isTabShow = true
            state.appTabContentBottomValue = 50
        },

        //更新底部菜单的选中项
        updateNowSelectedTabIndex(state,data){

            //记录底部菜单到本地存储
            sessionStorage.setItem("nowSelectedTabIndex",data);
            
            state.nowSelectedTabIndex = data;

            //修改当前选中tab
            for(var i=0;i<state.tabMenuData.length;i++){
                if(state.tabMenuData[i].tabIndex == data){
                   state.tabMenuData[i].tabIsSelected = true;
                }else{
                   state.tabMenuData[i].tabIsSelected = false; 
                }
            }
        },

        //更新底部提示数
        updateTabBadge(state,data){
            state.tabMenuData[data['index']].tabBadge = data['number'];
        },

        //更新底部菜单数量
        updateTabNumber(state,data){
            state.tabMenuData = data;
        }

    }
  }